package com.mspbots.core.wise.controller;

import com.mspbots.core.wise.model.TenantTicketReject;
import com.mspbots.core.wise.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.concurrent.Callable;

/**
 * @author Dinnes Zhang
 * @date
 */
@RestController
@RequestMapping(path = "sendMail")
public class SendMailController {

    @Autowired
    private SendMailService service;

    @PostMapping("/generate")
    public Callable generateMail(@RequestBody TenantTicketReject params) {
        return () -> service.generateMail(params);
    }

    @PostMapping("/send")
    public Callable generateMail(@RequestBody Map<String, Object> params) {
        return () -> service.send(params);
    }
}
